Skip to content

Conversation

@andrewlalis
Copy link
Contributor

No description provided.

@andrewlalis andrewlalis requested a review from a team as a code owner June 11, 2022 08:53
* @param args The set of arguments to pass to the formatter.
* @return The count.
*/
public static long countf(String queryFormat, Object... args) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of that method? Why not use PreparedStatement for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes count operations more compact and removes them from the specificity of jdbc.

countf("SELECT COUNT(id) FROM entries WHERE id = %d", 4);

versus

count("SELECT COUNT(id) FROM entries WHERE id = ?", s -> s.setLong(1, 4));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think such a method should be created since it may be used accidentally for user input without reading the documentation.

@jasonlessenich jasonlessenich merged commit 14cdffb into Java-Discord:main Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants